﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _73类的继承
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            B b = new B();
            b.x = 10;
            b.Fun();
            b.y = 20;

            A obj = b;//父类引用可以装子类的对象
        }
    }

    internal class A
    {
        public int x;
        public void Fun()
        {
        }
    }
    internal class B : A //B类可以重用A类的代码
    {
        public int y;
    }
}